#Load the library and Create Reference to Library object 
require 'watir'
include Watir

# define variables
testURL = 'http://www.asp.net/ajax/ajaxcontroltoolkit/Samples/NumericUpDown/NumericUpDown.aspx'

puts 'tests execution started'
1.times do
  ie = Watir::IE.new
  ie.goto testURL
  # Enter a numeric value and use the up and down buttons to increment/decrement (min:1 and max:7)
  numeric_numb_def = (ie.text_field(:id, 'ctl00_SampleContent_TextBox1').value)
  sleep (5)
  ie.button(:id,'ctl00_SampleContent_TextBox1_bUp').click
  numeric_numb_chang = (ie.text_field(:id, 'ctl00_SampleContent_TextBox1').value)
  puts (numeric_numb_chang + " goes after " + numeric_numb_def)
  # Choose your favorite month
  month_def = (ie.text_field(:id, 'ctl00_SampleContent_TextBox2').value)
  sleep (5)
  ie.button(:id,'ctl00_SampleContent_TextBox2_bUp').click
  month_chang = (ie.text_field(:id, 'ctl00_SampleContent_TextBox2').value)
  puts (month_chang + " goes after " + month_def)
  # Let the web service pick a random number between 0 and 1000 that is higher/lower than the displayed value
  random_def = (ie.text_field(:id, 'ctl00_SampleContent_TextBox3').value)
  ie.button(:id,'ctl00_SampleContent_TextBox3_bUp').click
  sleep (5)
  random_chang = (ie.text_field(:id, 'ctl00_SampleContent_TextBox3').value)
  puts (random_def + " must be < then  " + random_chang)
  sleep (5)
  # Use the arrow images to increment/decrement the value
  img_buttons_def = (ie.text_field(:id, 'ctl00_SampleContent_TextBox4').value)
  ie.button(:id,'ctl00_SampleContent_img2').click
  sleep (5)
  img_buttons_chang = (ie.text_field(:id, 'ctl00_SampleContent_TextBox4').value)
  puts (img_buttons_def + " |  " + img_buttons_chang)
  
  ie.close
end
puts 'tests execution finished'